/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package data;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
/**
 *
 * @author NS
 */
public class User_Delete {
    private Connection connect;
    public User_Delete(Connection connect){
        this.connect = connect;
    }
    public String delUser(String user, String currentUser){
        Statement delete;
        try {   
                delete = connect.createStatement();
                
                System.out.println("DROP USER " + user);
                delete.executeUpdate("DROP USER " + user);
                
                System.out.println("DELETE FROM USERTBL WHERE USERNAME = '"+
                                    user + "' AND USERNAME != '" + currentUser +"'");
                delete.executeUpdate("DELETE FROM USERTBL WHERE USERNAME = '"+
                                    user + "' AND USERNAME != '" + currentUser + "'");
                
                return "success";
        } catch (SQLException e) {
                // TODO Auto-generated catch block
                return e.getMessage();
        }
    }
}
